using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;

namespace Infrastructure.Interface
{
    /// <summary>
    /// 定义更新实体的接口
    /// <remarks></remarks>
    /// </summary>
    /// <typeparam name="T">实体类型</typeparam>
    public interface IUpdatable<T> where T : IEntity
    {
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        void Update(T entity);


        /// <summary>
        /// 批量更新
        /// </summary>
        /// <param name="updateExpression">更新表示式</param>
        /// <returns></returns>
        void Update(Expression<Func<T, T>> updateExpression);


        /// <summary>
        /// 批量更新
        /// </summary>
        /// <param name="filter">过滤条件</param>
        /// <param name="updateExpression">更新表达式</param>
        /// <returns></returns>
        void Update(Expression<Func<T, bool>> filter, Expression<Func<T, T>> updateExpression);

    }
}
